package com.zmn.plat.dubbo.impl.company.service;

import com.zmn.common.dto.VtDTO;
import com.zmn.common.dto2.ResponseDTO;
import com.zmn.plat.dubbo.interfaces.company.service.ServiceCompanyAreaListRemoteService;
import com.zmn.plat.dubbo.utils.DubboConsts;
import com.zmn.sp.common.enums.available.AvailableAreaLevelEnum;
import com.zmn.sp.dubbo.interfaces.available.AvailableAreaListRemoteService;
import org.apache.dubbo.config.annotation.Reference;
import org.apache.dubbo.config.annotation.Service;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.util.List;

/**
 * com.zmn.plat.dubbo.impl.company.service
 *
 * @author hankangshuai
 * @since 2021/2/20
 */
@Service(version = DubboConsts.INTERFACE_VERSION, validation = "true")
public class ServiceCompanyAreaListRemoteServiceImpl implements ServiceCompanyAreaListRemoteService {

    @Reference(version = com.zmn.sp.dubbo.utils.DubboConsts.INTERFACE_VERSION, check = false)
    private AvailableAreaListRemoteService availableAreaListRemoteService;

    @Override
    public ResponseDTO<Boolean> checkByPlatAndCityId(@NotNull(message = "平台不能为空") Integer plat,
                                                     @NotNull(message = "城市ID不能为空") Integer cityId) {
        return availableAreaListRemoteService.checkSpAvailableAreaByPlatAndCity(plat, cityId);
    }

    @Override
    public ResponseDTO<List<VtDTO>> listCityByManageCompanyId(@NotNull(message = "manageCompanyId不能为空") @Positive(message = "manageCompanyId必须为大于0的正整数") Integer manageCompanyId) {
        return availableAreaListRemoteService.listAvailableAreaBySpId(manageCompanyId, AvailableAreaLevelEnum.CITY);
    }

}
